package com.zmn.plat.services.impl.msg.conf;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zmn.plat.model.entity.msg.conf.MsgConf;
import com.zmn.plat.model.entity.msg.conf.MsgConfQuery;
import com.zmn.plat.persistence.interfaces.msg.conf.MsgConfDao;
import com.zmn.plat.services.interfaces.msg.conf.MsgConfService;

@Service
public class MsgConfServiceImpl implements MsgConfService {

    @Resource
    MsgConfDao msgConfDao;

    @Override
    public MsgConf findByKey(Integer msgId) {
        return msgConfDao.findByKey(msgId);
    }

    @Override
    public Integer findMaxSort() {
        return msgConfDao.findMaxSort();
    }

    @Override
    public List<MsgConf> listPageByQuery(MsgConfQuery query) {
        int count = countByQuery(query);
        query.setTotalCount(count);
        return msgConfDao.listPageByQuery(query);
    }

    @Override
    public List<MsgConf> listByQuery(MsgConfQuery query) {
        return msgConfDao.listByQuery(query);
    }

    @Override
    public List<MsgConf> listAll() {
        return msgConfDao.listAll();
    }

    // @Override
    // public List<StaffSimpleVO> listEligibleStaffgeByMsgId(Integer msgId) {
    // return msgConfDao.listEligibleStaffgeByMsgId(msgId);
    // }

    @Override
    public Integer countByQuery(MsgConfQuery query) {
        return msgConfDao.countByQuery(query);
    }

    @Override
    public Integer updateStatusByKey(MsgConf msgConf) {
        return msgConfDao.updateStatusByKey(msgConf);
    }

    @Override
    public Integer updateStatusBatchByKey(List<Integer> ids, Integer status, String mcStaffName) {
        return msgConfDao.updateBatchStatusByKey(ids, status, mcStaffName);
    }

    @Override
    public Integer updateSortByKey(MsgConf msgConf) {
        return msgConfDao.updateSortByKey(msgConf);
    }

    @Override
    public Integer updateSortByKey(Integer msgId, Integer sort, String mcStaffName) {
        MsgConf msgConf = new MsgConf();
        msgConf.setMsgId(msgId);
        msgConf.setSort(sort);
        msgConf.setUpdater(mcStaffName);

        return updateSortByKey(msgConf);
    }

    @Override
    public Integer updateByKey(MsgConf msgConf) {
        return msgConfDao.updateByKey(msgConf);
    }

    @Override
    public Integer insert(MsgConf msgConf) {
        return msgConfDao.insert(msgConf);
    }

    @Override
    public Integer deleteByKey(Integer msgId) {
        return msgConfDao.deleteByKey(msgId);
    }

}